package com.spring.framework.model.learn;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

/**
 * @author xuweizhi
 * @since 2020/12/04 17:20
 */
@SuppressWarnings("all")
public class ReflectWarning {
	static {
		try {
			Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
			theUnsafe.setAccessible(true);
			Unsafe u = (Unsafe) theUnsafe.get(null);

			Class cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
			Field logger = cls.getDeclaredField("logger");
			u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
		} catch (Exception e) {
			// ignore
		}
	}
}
